package cn.jannal;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ImportResource;

/**
 *  @Configuration
    @EnableAutoConfiguration 根据类路径中的jar包依赖为当前项目进行自动配置
    @ComponentScan
    以上三个注解等同于@SpringBootApplication springboot会自动扫面@SpringBootApplication所在类的同级包
    以及下级包里的Bean
 * @author jannal
 *
 *1、SpringBootServletInitializer是一个支持 Spring Boot的Spring WebApplicationInitializer实现
 *除了配置Spring的Dispatcher- Servlet，SpringBootServletInitializer还会在Spring应用程序上下文里查找
 *Filter、 Servlet或ServletContextInitializer类型的Bean，把它们绑定到Servlet容器里。
 */
@SpringBootApplication
@ComponentScan(basePackages={"cn.jannal.lock.web"})
@ImportResource(locations={"classpath:spring-mysql/applicationContext-all.xml"})
public class ApplicationMysql  extends SpringBootServletInitializer{
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(ApplicationMysql.class);
    }
    public static void main(String[] args) {
        SpringApplication.run(ApplicationMysql.class, args);
    }
}